/**
 * @author Kostya
 */
var iWindow = null;
var iOpener = null;

 Ext.onReady(function(){
	iOpener = Ext.air.NativeWindow.getRootHtmlWindow();
	iOpener.iReminderWinReference = window;
	iWindow = window.nativeWindow;
	iWindow.alwaysInFront = true;
	Ext.QuickTips.init();
	
	var lViewport = new Ext.Viewport({
		layout: 'fit',
		items: {			
			html: '<div id="caption"></div>',
			bodyStyle: 'background-color: #DFE8F6;',				
			buttonAlign: 'center',
			buttons:[{
				text: 'Ok',
				handler: function(){
					iWindow.close();
				}
			}]
		}
	});
	
	lViewport.on('show', function(){
		updateCaption();		
	})
	
	iWindow.visible = true;
	iWindow.activate();
	
	lViewport.doLayout();
	updateCaption();
});

var updateCaption = function(){
//	air.trace('Updating caption...'+iOpener);
	if(!iOpener.iEventCaption)
		iOpener.iEventCaption = '';
	if(!iOpener.iEventDates)
		iOpener.iEventDates = '';
//	if(!document.getElementById('caption')){
//		air.trace('xxxxxxx');
//	}
	var lResult = 
		'<div class="caption"><b>Event:</b> '+iOpener.iEventCaption+'</div>'+
		'<div class="dates"><b>Time:</b> '+iOpener.iEventDates+'</div>';
	if(iOpener.iEventRecInfo)
		lResult += '<div class="dates"><b>Recurrence:</b> '+iOpener.iEventRecInfo+'</div>';
	document.getElementById('caption').innerHTML = lResult;
};
